package com.xiaoshuidi.cloud.module.report.controller.finance;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.report.controller.finance.vo.*;
import com.xiaoshuidi.cloud.module.report.convert.finance.IncomeSummaryConvert;
import com.xiaoshuidi.cloud.module.report.dal.DO.report.IncomeDetailReportDO;
import com.xiaoshuidi.cloud.module.report.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.report.service.finance.IncomeDetailReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;

/**
 * 收入汇总报表
 */

@Slf4j
@Tag(name = "管理后台 - 收入汇总报表")
@RestController
@RequestMapping(ApiConstants.PREFIX+"/income")
public class IncomeDetailReportController {

    @Resource
    private IncomeDetailReportService incomeDetailReportService;


    @PostMapping("/detailInPage")
    @Operation(summary = "收入汇总明细分页查询")
    public CommonResult<PageResult<DetailIncomePageRespVO>> detailIncomePage(@RequestBody @Valid DetailIncomePageReqVO reqVO) {
        log.info("IncomeDetailReportController detailIncomePage req:{}",reqVO.toString());
        return success(incomeDetailReportService.detailIncomePage(reqVO));
    }

    /**
     * 收入汇总明细表导出
     *
     * @param req
     * @return
     */
    @PostMapping("/detailInExport")
    public CommonResult<ExportRespVO>  detailIncomeExport(@RequestBody @Valid DetailIncomePageReqVO req) {
        log.info("IncomeDetailReportController detailIncomeExport req:{}",req.toString());
        return CommonResult.success(incomeDetailReportService.detailIncomeExport(req));
    }

}
